Skip to content

management vrf using vrf function of new kernel#2411

Closed
batmancn wants to merge 2 commits intosonic-net:masterfrom
batmancn:management-vrf
Closed

management vrf using vrf function of new kernel#2411
batmancn wants to merge 2 commits intosonic-net:masterfrom
batmancn:management-vrf

Conversation

@batmancn
Copy link
Copy Markdown

@batmancn batmancn commented Jan 3, 2019

  • What I did

Implement management vrf function follow this spec, phase 1. This PR based on #2348 .

#2405 also define management vrf function, by namespace. This is another way to implement management vrf using vrf function in new kernel 4.5.

  • How I did it

I use DB to set management vrf.
I use 'interfaces-config.sh' to trigger network restart.
For details, refer to 'How to verify it' section.

  • How to verify it
  1. use default DB settings to start SONiC
  2. copy modified files as bellow
scp ./files/image_config/interfaces/interfaces.j2 root@172.18.8.213:/usr/share/sonic/templates/interfaces.j2
  1. use these steps to add management vrf in DB
# cat /root/mgmt-vrf.del.json
{
    "MGMT_INTERFACE": {
        "eth0|172.18.8.213/24": null
    }
}

# config load -y /root/mgmt-vrf.del.json

# cat /root/mgmt-vrf.add.json
{
    "MGMT_INTERFACE": {
        "eth0|172.18.8.213/24": {
            "gwaddr": "172.18.8.1",
            "vrfname": "mgmtvrf"
        }
    }
}

# config load -y /root/mgmt-vrf.add.json
  1. use this command to restart network and set management vrf
bash /usr/bin/interfaces-config.sh
  1. use this command to verify
root@sonic:~# ip route show table 1001
default via 172.18.8.1 dev eth0
broadcast 172.18.8.0 dev eth0 proto kernel scope link src 172.18.8.213
172.18.8.0/24 dev eth0 proto kernel scope link src 172.18.8.213
local 172.18.8.213 dev eth0 proto kernel scope host src 172.18.8.213
broadcast 172.18.8.255 dev eth0 proto kernel scope link src 172.18.8.213
  1. use these steps to del management vrf in DB
# cat /root/mgmt-vrf.del.json
{
    "MGMT_INTERFACE": {
        "eth0|172.18.8.213/24": null
    }
}

# config load -y /root/mgmt-vrf.del.json

# cat /root/mgmt-vrf.old.json
{
    "MGMT_INTERFACE": {
        "eth0|172.18.8.213/24": {
            "gwaddr": "172.18.8.1"
        }
    }
}

# config load -y /root/mgmt-vrf.old.json
  1. use this command to restart network and set management vrf
bash /usr/bin/interfaces-config.sh
  1. use these command to verify
# ip route show table 1001

# ip route show
default via 172.18.8.1 dev eth0 proto zebra
...
172.18.8.0/24 dev eth0 proto kernel scope link src 172.18.8.213
240.127.1.0/24 dev docker0 proto kernel scope link src 240.127.1.1 linkdown
  • Known issue

Services based on old socket will be break down in a short time, like sshd/ntpd/logd...

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants